﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace StatsData.Data.Migrations
{
    public partial class add_table_sn_wait_and_test_record : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "T_WIP_SN_TEST_STATIS_RECORD",
                columns: table => new
                {
                    ID = table.Column<string>(type: "VARCHAR2(50)", maxLength: 50, nullable: false),
                    TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    STATIS_KEY = table.Column<string>(type: "NVARCHAR2(80)", maxLength: 80, nullable: true),
                    WORK_CODE = table.Column<string>(type: "NVARCHAR2(30)", maxLength: 30, nullable: false, defaultValue: ""),
                    EXT_ORG_CODE = table.Column<string>(type: "NVARCHAR2(30)", maxLength: 30, nullable: true),
                    PRODUCT_CODE = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: false, defaultValue: ""),
                    WORK_PROCESS_DETAIL_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    PROCEDURE_NAME = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    LINE_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: false, defaultValue: ""),
                    WORKSTAGE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    WORKSTAGE_NAME = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    PROCEDURE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    BAD_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    NTF_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    FINISH_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    FIRST_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    FIRST_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    SECOND_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    SECOND_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    THREE_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    THREE_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TOTAL_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TOTAL_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TOTAL_OK_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    RETEST_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    RETEST_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TWO_OK_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TEST_RECORD = table.Column<string>(type: "NVARCHAR2(400)", maxLength: 400, nullable: true),
                    ORG_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    CREATE_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    MODIFY_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    IS_DELETED = table.Column<bool>(type: "NUMBER(1)", nullable: false),
                    ROW_VERSION = table.Column<int>(type: "NUMBER(10)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_WIP_SN_TEST_STATIS_RECORD", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "T_WIP_SN_WAIT_TEST_STATIS_RECORD",
                columns: table => new
                {
                    ID = table.Column<string>(type: "VARCHAR2(50)", maxLength: 50, nullable: false),
                    TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    STATIS_KEY = table.Column<string>(type: "NVARCHAR2(80)", maxLength: 80, nullable: true),
                    WORK_CODE = table.Column<string>(type: "NVARCHAR2(30)", maxLength: 30, nullable: false, defaultValue: ""),
                    PRODUCT_CODE = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: false, defaultValue: ""),
                    LINE_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: false, defaultValue: ""),
                    EXT_ORG_CODE = table.Column<string>(type: "NVARCHAR2(30)", maxLength: 30, nullable: true),
                    WORKSTAGE_NAME = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    WORKSTAGE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    PROCEDURE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    PROCEDURE_NAME = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    REWORK_SN_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TOTAL_TEST_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    SN_CODES = table.Column<string>(type: "NVARCHAR2(2000)", maxLength: 2000, nullable: true),
                    REWORK_SN_CODES = table.Column<string>(type: "NVARCHAR2(2000)", maxLength: 2000, nullable: true),
                    ORG_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    CREATE_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    MODIFY_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    IS_DELETED = table.Column<bool>(type: "NUMBER(1)", nullable: false),
                    ROW_VERSION = table.Column<int>(type: "NUMBER(10)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_WIP_SN_WAIT_TEST_STATIS_RECORD", x => x.ID);
                });

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_TEST_STATIS_RECORD_CREATE_TIME",
                table: "T_WIP_SN_TEST_STATIS_RECORD",
                column: "CREATE_TIME");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_TEST_STATIS_RECORD_LINE_CODE",
                table: "T_WIP_SN_TEST_STATIS_RECORD",
                column: "LINE_CODE");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_TEST_STATIS_RECORD_PRODUCT_CODE",
                table: "T_WIP_SN_TEST_STATIS_RECORD",
                column: "PRODUCT_CODE");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_TEST_STATIS_RECORD_WORK_CODE",
                table: "T_WIP_SN_TEST_STATIS_RECORD",
                column: "WORK_CODE");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_WAIT_TEST_STATIS_RECORD_CREATE_TIME",
                table: "T_WIP_SN_WAIT_TEST_STATIS_RECORD",
                column: "CREATE_TIME");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_WAIT_TEST_STATIS_RECORD_LINE_CODE",
                table: "T_WIP_SN_WAIT_TEST_STATIS_RECORD",
                column: "LINE_CODE");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_WAIT_TEST_STATIS_RECORD_PRODUCT_CODE",
                table: "T_WIP_SN_WAIT_TEST_STATIS_RECORD",
                column: "PRODUCT_CODE");

            migrationBuilder.CreateIndex(
                name: "IX_T_WIP_SN_WAIT_TEST_STATIS_RECORD_WORK_CODE",
                table: "T_WIP_SN_WAIT_TEST_STATIS_RECORD",
                column: "WORK_CODE");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_WIP_SN_TEST_STATIS_RECORD");

            migrationBuilder.DropTable(
                name: "T_WIP_SN_WAIT_TEST_STATIS_RECORD");
        }
    }
}
